package com.aviation.sell_ticket.service.impl;

import com.aviation.sell_ticket.mapper.FlightPriceMapper;
import com.aviation.sell_ticket.pojo.Aviation_flight;
import com.aviation.sell_ticket.pojo.Aviation_flight_price;
import com.aviation.sell_ticket.service.FlightPriceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FlightPriceServiceImpl implements FlightPriceService {

    @Resource
    private FlightPriceMapper flightPriceMapper;//引入FlightPriceMapper

    /**
     * 使用航班id查询航班价格
     * @param flightId 航班id
     * @return Aviation_flight_price
     */
    @Override
    public Aviation_flight_price queryFlightPrices(String flightId) {
        return flightPriceMapper.queryFlightPrices(flightId);
    }

    /**
     * 根据多个航班id查询价格最低的两趟航班信息
     * @param flight 航班信息
     * @return List<Aviation_flight_price>
     */
    @Override
    public List<Aviation_flight_price> queryFlightPriceMap(List<Aviation_flight> flight) {
        return flightPriceMapper.queryFlightPriceMap(flight);
    }
}
